<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>家政服务详情</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.3/css/jquery-weui.min.css">
		<link rel="stylesheet" href="../css/index.css" />
	</head>
	<body id="housedetails">
		<header>
			<div id="swiper-container1" class="swiper-container" data-space-between='10' data-pagination='.swiper-pagination' data-autoplay="1000">
				<div class="swiper-wrapper" id="imglist">
					<!--<div class="swiper-slide"><img src="../img/jzfw.png" /></div>
					<div class="swiper-slide"><img src="../img/jzfw.png" /></div>
					<div class="swiper-slide"><img src="../img/jzfw.png" /></div>
					<div class="swiper-slide"><img src="../img/jzfw.png" /></div>-->
				</div>
				<div class="swiper-pagination"></div>
			</div>
		</header>
		<div class="hou_top">
			<!--<h1>管家帮家政服务</h1>
			<span><b>50</b>元/小时</span>-->
		</div>
		<div class="main">
			<ul>
				<li class="active">商品详情</li>
				<li>付费规则</li>
			</ul>
			<section>
				<div id="detail">
					
				</div>
				<div class="hide">
					<table border="1" id="chargelist" >
						  <!--<tr>
						    <th>产品规格</th>
						    <th>收费</th>
						  </tr>
						  <tr>
						    <td> </td>
						    <td> </td>
						  </tr>
						  <tr>
						    <td> </td>
						    <td> </td>
						  </tr>
						  <tr>
						    <td> </td>
						    <td> </td>
						  </tr>-->
					</table>
				</div>
			</section>
		</div>
		<footer>
			<a href="javascript:;" id="show-custom" class="weui_btn weui_btn_primary">立即预定</a>
			
		</footer>
		
		
		
		<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/jquery-weui/0.8.3/js/jquery-weui.min.js"></script>
		<script src="//cdn.bootcss.com/jquery-weui/0.8.3/js/swiper.min.js"></script>
		<script type="text/javascript" src="../js/basic.js" ></script>
		<script type="text/javascript">
				
				$(".main ul li").click(function(){
					$index=$(this).index();
					$(this).addClass("active").siblings().removeClass("active")
		    		$("section > div").eq($index).show().siblings().hide(); 
				})
				
		      
    		
    		var ip_addr = getUrl();
    		$(document).ready(function() {
    			servedetail();
    			chargelist();
    		})
    		//家政服务详情接口
			function servedetail() {
				var id=GetQueryString("id");
				$.ajax({
					type: 'post',
					dataType: "json",
					url: ip_addr + 'serve/detail',
					data: {
						id: id
					},
					success: function(data) {
						var result = data.data;
						var innerHTML = '';
						var imgHTML = '';
						if(data.code == 0) {
							innerHTML += '<h1>'+result.name+'</h1>';
							innerHTML += '<span><b>'+(result.price/100)+'</b>元/'+result.punit+'</span>';
							var detail = result.detail.replace('../',"");
							$("#detail").html(detail)
							$(".hou_top").append(innerHTML);
							
							$("#show-custom").attr("href","tel:"+result.phone+"")
							
							var str = result.mimg;
							
							var imglist=str.split(',');
							
							for(var i = 0;i<imglist.length;i++){
								imgHTML += '<div class="swiper-slide"><img src="'+imglist[i].replace('../',"")+'" /></div>';
							}
														
							$("#imglist").append(imgHTML);
							
							var mySwiper = new Swiper('#swiper-container1', {
								autoplay: 5000,
								pagination: '.swiper-pagination',
								paginationClickable: true,
							});
							
						} else {
							alert(data.msg);
						}
					}
				});
			}
			//家政服务详情-收费规则接口
			function chargelist() {
				var id=GetQueryString("id");
				$.ajax({
					type: 'post',
					dataType: "json",
					url: ip_addr + 'charge/list ',
					data: {
						id: id
					},
					success: function(data) {
						var result = data.rows;
						var innerHTML = '';
						if(data.code == 0) {
						 innerHTML +='<tr>';
						 innerHTML +='<th>产品规格</th>';
						 innerHTML +='<th>收费</th>';
						 innerHTML +='</tr>';
						for(var i = 0; i < result.length; i++) {	
						  innerHTML +='<tr>';
						  innerHTML +='<td>'+result[i].name+'</td>';
						  innerHTML +='<td>'+(result[i].price/100)+'</td>';
						  innerHTML +='</tr>';
						}
						$("#chargelist").append(innerHTML);
						} else {
							alert(data.msg);
						}
					}
				});
			}
		</script>
	</body>
</html>
